package com.zzyl.member.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.member.dto.servceListDTO;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import static com.zzyl.common.utils.PageUtils.startPage;

@RestController
@RequestMapping("/member/orders/project")
@Api(tags = "小程序服务项目管理")
@Component
public class serviceController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("服务项目分页查询")
    public TableDataInfo<NursingProject> list(servceListDTO servceListDTO) {
        IPage<NursingProject> list = nursingProjectService.servceNursingProjectList(servceListDTO);
        //把IPage对象转换成list集合
        return getDataTable(list.getRecords());
    }

    @GetMapping("/{id}")
    @ApiOperation("服务项目详情查询")
    public NursingProject getInfo(@PathVariable Long id) {
        return nursingProjectService.selectNursingProjectById(id);
    }
}
